<?php
namespace app\common\logic;

use think\Controller;
use app\common\model\BannerPosition as BannerPositionaModel;
use app\common\model\Banner as BannerModel;

class Banner extends Controller
{
    /**
     * 获取某个广告位
     *
     **/
    public function getbannerposition($pid){

      return BannerPositionaModel::where("id",$pid)->where("status",1)->where("isDeleted",1)->field("id,name,desc,width,height")->find();

    }

    /**
     * 根据广告位id获取广告
     *
     **/
    public function getbannerlist($pid){

        return BannerModel::alias('b')
            ->join('t_picture p','b.pictureid = p.id','LEFT')
            ->where("b.status",1)
            ->where("pid",$pid)->field("b.*,p.picurl")->order("b.addtime desc")->select();

    }
}